#include<iostream>
#include<cstring>
using namespace std;
char g[5][5];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		memset(g, 0, sizeof(g));
		for (int i = 0; i < 4; i++) {
			cin >> g[i];
		}
		bool flag = 0;
		for (int i = 0; i < 3; i++) {
			flag = 0;
			for (int j = 0; j < 3; j++) {
				if (g[i][j] == g[i][j + 1] && g[i][j] == g[i + 1][j] && g[i][j] == g[i + 1][j + 1]) {
					flag = 1;
				}
			}
			if (flag) {
				break;
			}
		}
		if (flag) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	return 0;
}